# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Troy C < rstrox -ta yahoo -tod com >

pkgname=python-wrapt
pkgver=1.12.1
pkgrel=4
pkgdesc="A Python module for decorators, wrappers and monkey patching"
arch=("x86_64")
url="https://pypi.python.org/pypi/wrapt"
license=("BSD")
depends=('python')
makedepends=('python')
checkdepends=('python-pytest')
source=("$pkgname-$pkgver.tar.gz::https://github.com/GrahamDumpleton/wrapt/archive/$pkgver.tar.gz"
        py39.patch)
sha512sums=('33e964cb3aa2437bc7d084a98f622f7c5c8c719d97806796ae0317d35130bdb2679a9dd87be7077e2cae1eb32b65d152349fa7cc138cb392d5999cbfdcecc9ac'
            '372323f80578bc1fe2fdf8d3a5dc67b79956180048f8036be429b3e2fed4c9f3ce3d29a2c9e8b6128a2ab64cf7d21dc1e7026e8df14a062a94bd8518aca5b50a')

prepare() {
  cd "$srcdir"/wrapt-$pkgver
  patch -Np1 -i ../py39.patch # https://github.com/GrahamDumpleton/wrapt/issues/160
}

build() {
  cd "$srcdir"/wrapt-$pkgver
  python setup.py build
}

check() {
  cd "$srcdir"/wrapt-$pkgver
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.9:$PYTHONPATH" py.test
}

package() {
  cd wrapt-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
